# Maintainer: Thomas Liske <thomas@fiasko-nw.net>
pkgname=efibootguard
pkgver=0.16
pkgrel=0
pkgdesc="Simple UEFI boot loader with support for safely switching between current and updated partition sets"
url="https://github.com/siemens/efibootguard/"
arch="aarch64 riscv64 x86 x86_64"
license="GPL-2.0-only"
depends="python3"
makedepends="
	argp-standalone
	autoconf
	autoconf-archive
	automake
	bsd-compat-headers
	check-dev
	gnu-efi-dev
	libtool
	linux-headers
	pciutils-dev
	py3-shtab
	python3
	"
checkdepends="bats"
options="!check" # fff is missing on alpine
source="$pkgname-$pkgver.tar.gz::https://github.com/siemens/efibootguard/archive/v$pkgver/efibootguard-$pkgver.tar.gz
	0001-fallback-outb_p.patch
	0002-gcc14.patch
	"
subpackages="$pkgname-dev $pkgname-bash-completion $pkgname-zsh-completion"

prepare() {
	default_prepare
	autoreconf -fvi
}

build() {
	./configure
	make LIBS="-largp"
}

package() {
	make DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir/usr/share/bash-completion"
	mv "$pkgdir/usr/share/efibootguard/completion/bash" "$pkgdir/usr/share/bash-completion/completions"

	mkdir -p "$pkgdir/usr/share/zsh"
	mv "$pkgdir/usr/share/efibootguard/completion/zsh" "$pkgdir/usr/share/zsh/site-functions"
}

sha512sums="
a3b4c2ec70ad9a50b728145edf180e8c171a7876653c6984e53c2bdf6b85316098ab734590d778f11b986d070a0d061ce095c0a1b9164a73519004557dc4a785  efibootguard-0.16.tar.gz
14c72455a9fea4b796a19a6c2713765ff1eb82f6ab5d4ab72ab61e8f4824aa6436a4d7bb003c50235a44c089559dc27e717e90aeb624b19de2522436911c4343  0001-fallback-outb_p.patch
4d71622db9940bfab60e5f25b8f8e53622adf94abf20b713c623120bb998099246856983399bd4096be63567ef10a67567e87b8721670261c0718e54018eedc8  0002-gcc14.patch
"
